import React,{FC, useState} from 'react';

interface IProps{
  // 属性是父组件传递过来的值
  name:string;
  cId?:number;
}
// 
const FnComponent:FC<IProps> = (props)=>{
  const [count,setCount] = useState<number>(0);
  //ReactElement<any, any> | null”
  return <div>
    {props.name}
    <button onClick={()=>setCount(count-1)}>-</button>
    {count}
    <button onClick={()=>setCount(count+1)}>+</button>
    <hr />
    {/* react 的children 类似于vue的插槽 */}
    {props.children}
  </div>;

};

export default FnComponent;